const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sys_scope_api', {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "主键"
    },
    menuId: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "菜单主键",
      field: 'menu_id'
    },
    resourceCode: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "资源编号",
      field: 'resource_code'
    },
    scopeName: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "接口权限名",
      field: 'scope_name'
    },
    scopePath: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "接口权限地址",
      field: 'scope_path'
    },
    scopeType: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "接口权限类型",
      field: 'scope_type'
    },
    remark: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "接口权限备注"
    },
    createUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建人",
      field: 'create_user'
    },
    createDept: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建部门",
      field: 'create_dept'
    },
    createTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间",
      field: 'create_time'
    },
    updateUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "修改人",
      field: 'update_user'
    },
    updateTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "修改时间",
      field: 'update_time'
    },
    status: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "状态"
    },
    isDeleted: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "是否已删除",
      field: 'is_deleted'
    }
  }, {
    sequelize,
    tableName: 'sys_scope_api',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
